package net.seehealth.healthpad.ui.view;

import net.seehealth.healthpad.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.RelativeLayout.LayoutParams;

public class OftenWordItemView extends RelativeLayout {

	private Context mContext;
	private TextView mtextView;
	View view;
	public OftenWordItemView(Context context) {
		super(context);
		this.mContext = context;
		initialize();
		// TODO Auto-generated constructor stub
	}

	/**
	 * 初始化视图r
	 */
	private void initialize() {
		 view = LayoutInflater.from(mContext).inflate(
        		R.layout.pop_word_item, null);
		addView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

		mtextView = (TextView)findViewById(R.id.tv_word);
		
	}
	/**
	 * 刷新视图
	 * @param name 任务名
	 * @param index 任务下标
	 */
	public void updateView(String name,int position) {
		mtextView.setText(name+".");
		if(position%2 == 0){
			view.setBackgroundResource(R.drawable.listview_oftenword_bg1);
		}else{
			view.setBackgroundResource(R.drawable.listview_oftenword_bg2);
		}
	}

	
}
